## some analysis of the post-experiment survey responses
##
## Cait Unkovic, Maya Sen, Kevin Quinn
##
## 12/16/2014
##




## survey responses for subgroupls
sdata.reject <- read.csv("survey-data-reject.csv")
sdata.accept <- read.csv("survey-data-accept.csv")
sdata.treat.applied <- read.csv("survey-data-treat-applied.csv")
sdata.control.applied <- read.csv("survey-data-control-applied.csv")

sdata.treat.reject <- read.csv("survey-data-treat-reject.csv")
sdata.treat.accept <- read.csv("survey-data-treat-accept.csv")
sdata.control.reject <- read.csv("survey-data-control-reject.csv")
sdata.control.accept <- read.csv("survey-data-control-accept.csv")



## average years in grad school for treated and control women
xbar.t <- mean(sdata.treat.applied$g.years[sdata.treat.applied$sex==2])
sd.t <- sd(sdata.treat.applied$g.years[sdata.treat.applied$sex==2])
n.t <- length(sdata.treat.applied$g.years[sdata.treat.applied$sex==2])

xbar.c <- mean(sdata.control.applied$g.years[sdata.control.applied$sex==2])
sd.c <- sd(sdata.control.applied$g.years[sdata.control.applied$sex==2])
n.c <- length(sdata.control.applied$g.years[sdata.control.applied$sex==2])

t.out <- t.test(sdata.treat.applied$g.years[sdata.treat.applied$sex==2],
                sdata.control.applied$g.years[sdata.control.applied$sex==2])


### quant courses among treated and control female applicants
cat("quant courses among treated female applicants:\n")
print(table(sdata.treat.applied$quant.courses[sdata.treat.applied$sex==2]))
cat("quant courses among control female applicants:\n")
print(table(sdata.control.applied$quant.courses[sdata.control.applied$sex==2]))





### subfields among treated and control female applicants
## 1 = American
## 2 = Comparative
## 4 = IR
## 5 = Methodology
cat("\n\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n")
cat("\n\nsubfields among treated female applicants:\n")
print(table(sdata.treat.applied$subfield[sdata.treat.applied$sex==2]))
cat("\n\nsubfields among control female applicants:\n")
print(table(sdata.control.applied$subfield[sdata.control.applied$sex==2]))
cat("\n\nsubfields among treated female applicants who were rejected:\n")
print(table(sdata.treat.reject$subfield[sdata.treat.reject$sex==2]))
cat("\n\nsubfields among control female applicants who were rejected:\n")
print(table(sdata.control.reject$subfield[sdata.control.reject$sex==2]))





######################################################################
## interference check

sdata <- read.csv("survey-data.csv")
n.treat <- sum(sdata$treat=="Treated")
forward.none <- sum(sdata$forward.none, na.rm=TRUE) 
forward.dept.fac <- sum(sdata$forward.dept.fac, na.rm=TRUE)
forward.out.fac <- sum(sdata$forward.out.fac, na.rm=TRUE)
## number of students who forwarded encouragement to departmental students:
forward.dept.stu <- sum(sdata$forward.dept.stu, na.rm=TRUE)
## number of students who forwarded encouragement to outside students:
forward.out.stu <- sum(sdata$forward.out.stu, na.rm=TRUE)
forward.non.acad <- sum(sdata$forward.non.academic, na.rm=TRUE)
## nuber fo students who forwarded encouragement to institutional email list:
forward.list <- sum(sdata$forward.list, na.rm=TRUE)



